@isTest
private class testCopySolutionsToAccountClass
{
Static testMethod void testCopySolutionsToAccount()
{

    Opportunity  opty1 = new Opportunity();
    opty1.Name= 'TestOpty1';
    opty1.CloseDate= system.today();
    opty1.StageName='Prospecting';
    opty1.Amount=10002; 
    opty1.Contract_Term__c = 10; 
    opty1.TCV_HRO__c = 200; // to satisify validation rule which checks the TCV field is not null
    insert opty1; 
    
    // fetch the record types available for solution Object 
    List<Schema.RecordTypeInfo> recinfo = Solution__C.SObjectType.getDescribe().getRecordTypeInfos();
    List<ID> recType = new List<ID>();
    For(integer i=0;i<recinfo.size() ;i++)
    {
     recType.add(recinfo[i].getRecordTypeID());
     system.debug('+++++ record type name ' + recinfo[i].getName());
    }
     
       Solution__c solcon = new Solution__c();
       Solution__c solout = new Solution__c();
       Solution__c solsoft = new Solution__c();
       
       solcon.Opportunity__c = opty1.id;  
       solcon.opportunity__r = opty1;
       solcon.Product__c = 'Upgrade';  // to test the validation rule 'Requiredfield'
       solcon.recordtypeID = recType[0];//inserted the 'consulting' recordtype
       
       solout.Opportunity__c = opty1.id;  
       solout.opportunity__r = opty1;
       solout.Deployment__c = 'Managed'; // to test the validation rule on deployment field which  makes it required 
       solout.Product__c = 'HR Outsourcing';  // to test the validation rule 'Requiredfield'
       solout.recordtypeID = recType[1];//inserted the 'Outsourcing' recordtype
       
       solsoft.Opportunity__c = opty1.id;  
       solsoft.opportunity__r = opty1;
       solsoft.Deployment__c = 'Provisioning';
       solsoft.Product__c = 'Optimum';  // to test the validation rule 'Requiredfield'
       solsoft.recordtypeID = recType[2];//inserted the 'Software' recordtype*/
      
       insert solcon; 
       insert solout;
       insert solsoft;
       
       string result = CopySolutionsToAccount.amethod(opty1.id);
       
       SolutionComponent__c solc1 = new SolutionComponent__c();
       SolutionComponent__c solc2 = new SolutionComponent__c();
       SolutionComponent__c solc3 = new SolutionComponent__c();
       
       solc1.Component__c = 'Training';
       solc1.Days__c = 5;
       solc1.Implementation_Start_Date__c = date.today();
       solc1.Go_Live_Date__c = date.today() + 2 ;
           
          /* componentFields.add('Total_Implementation_Revenue__c'); 
           componentFields.add('Total_Implementation_Cost__c');
           componentFields.add('Implementation_Type__c');*/
    
    }
   
    
    }